<template>
    <div class="search">
        <Nav :title="title" :path="path"></Nav>
        <div class="content">
            <van-search v-model="value" placeholder="请输入搜索关键词" @input="handleChange(value)"/>
            <div v-if="searchMovie.length!=0">
                <Content :item="searchMovie"></Content>
            </div>
            <div v-if="searchMovie.length==0">无结果</div>
        </div>
    </div>
</template>

<script>
import Content from '../../components/Content.vue';
    export default {
  components: { Content },
        data() {
            return {
                path:'/tabbar/movie',
                title:'光与影',
                value:'',
                searchMovie:[]
            }
        },
        methods: {
            async handleChange(value){
                var res = await this.$http.get(`/search?keyword=${value}`)
                this.searchMovie = res.data.result
            }
        },
        
    }
</script>

<style scoped>
.search .content{
    margin-top: 90px;
}
</style>